<template>
  <div class="day7">
    <div class="title">空气质量预报</div>
    <template v-for="item in day7" :key="item.date">
      <div class="data">
        <div class="day">
          {{ item.day }}
          <div class="date">{{ item.date }}</div>
        </div>

        <div class="len">
          <div
            class="value"
            :style="{ width: `${(item.aqi / 300) * 100}%` }"
          ></div>
        </div>
        <div class="aqi">{{ item.aqi }}</div>
        <div class="txt">{{ item.txt }}</div>
      </div>
    </template>
  </div>
</template>

<script setup>
const props = defineProps({
  day7: {
    type: Object,
  },
});
</script>

<style lang="less" scoped>
.day7 {
  margin-top: 20px;
  padding: 30px 20px 20px;
  border-radius: 16px;
  background-color: #f7f8f9;
  border: 1px solid #f2f4fa;
  .title {
    font-size: 20px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    margin-bottom: 28px;
  }
  .data {
    display: flex;
    margin: 10px auto;
    height: 40px;
    max-width: 800px;
    text-align: center;
    .len {
      flex: 3;
      margin: auto 0;
      border-radius: 3px;
      background-color: #d7d9df;
      height: 6px;
      .value {
        border-radius: 3px;
        background-color: #a9a538;
        height: 6px;
      }
    }
    .day {
      width: 80px;
      margin-right: 30px;
      .date {
        font-size: 15px;
        color: rgba(0, 0, 0, 0.5);
      }
    }

    .aqi {
      margin: auto 0;

      margin-left: 30px;
      width: 30px;
      font-size: 18px;
      font-weight: 500;
    }
    .txt {
      margin: auto 0;

      margin-left: 30px;
      width: 30px;
      font-size: 18px;
      font-weight: 500;
    }
  }
}
</style>